import request from '@/utils/request'

/**
 * 获取企业的部门列表
 * @returns
 */
export const reqGetDepartments = () => {
  return request({
    method: 'GET',
    url: '/company/department'
  })
}

/**
 * 删除部门
 * @param {*} id 需要删除的部门id
 * @returns
 */
export const reqDelDepartments = (id) => request({
  method: 'DELETE',
  url: `/company/department/${id}`
})

/**
 * 新增部门
 * @param {*} form 表单的所有字段信息
 * @returns
 */
export const reqAddDepartments = (form) => request({
  method: 'POST',
  url: '/company/department',
  data: form
})

/**
 * 根据ID查询部门详情
 * @param {*} id 当前部门的id
 * @returns
 */
export const reqGetDepartDetails = (id) => {
  return request({
    method: 'GET',
    url: `/company/department/${id}`
  })
}

export const reqEditDepartments = (id) => {
  return request({
    method: 'PUT',
    url: `/company/department/${id}`
  })
}
